<template>
  <div class="wrapper">
    <nav_bar title='订单详情' background='#fff' :back="true"  @back="handlerGobackClick"></nav_bar>
    <div class="item" v-for="(item,index) of orderList" :key="index">
      <div class="item_left">
        <div class="item_order"><span>订单号</span>{{item.order_num}}</div>
        <div class="item_name" v-if="item.point_item_info"><span>项目名</span>{{item.point_item_info.project_name}}</div>
        <div class="item_type" v-if="item.type_name"><span>订单类型</span>{{item.type_name}} {{item.vip_rule_name}}</div>
        <div class="item_time"><span>订单日期</span>{{item.updated_at}}</div>
      </div>
      <div class="item_right">
        <div>{{item.status_name}}</div>
        <div v-if="item.status_name!='未完成'">{{item.s_amount}}</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      orderList:''
    }
  },
  methods: {
    handlerGobackClick(){
      wx.switchTab({url:`/pages/me/main`})
    },
    async getOrderList(){
      const userToken=wx.getStorageSync('userToken')
      const res=await this.$request.getData('/ucenter/getOrdersList',{
        user_token:userToken
      })
      if(res.data.level=='success'){
        this.orderList=res.data.data;
      }
    }
  },
  onLoad(){
    this.getOrderList()
  }
}
</script>
<style lang="scss" scoped>
  .wrapper{
    width: calc(100% - 20px);
    margin-left:10px;
  }
  .item{
    padding:10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
  }
  .item_left{
    div{
      margin-bottom: 10px;
    }
    .item_order,.item_name,.item_type,.item_name,.item_time{
      span:nth-child(1){
        margin-right: 10px;
      }
    }
  }
  .item_right{
    margin-right: 20px;
    div{
      margin-bottom: 10px;
    }
  }
</style>
